
<template>
  <div>
    <!--用于展示缩略图-->
    <span
      v-if="code"
      @click="codeClick"
    >{{ code }}</span>
  </div>
</template>
<script>
export default {
  props: {
    id: {
      type: [Number, String],
      default: ''
    },
    code: {
      type: String,
      default: ''
    },
    routePath: {
      type: String,
      default: '',
      required: false
    },
    queryData: {
      type: Object,
      default() {
        return {}
      },
      required: false
    }
  },
  data() {
    return {}
  },
  created() {
    // console.log(1111,this.code,this.id)
  },
  methods: {
    codeClick() {
      if (this.routePath) {
        this.$router.push({ path: this.routePath, query: this.queryData })
      } else {
        this.$emit('click', this.id ? this.id : this.code)
      }
    }
  }
}
</script>
<style scoped>
span {
  color: #5c90d2;
  cursor: pointer;
}
</style>

